<?php
class caf_review extends controller{

  function caf_review()
  {
    parent::Controller();
    $this->load->helper('url');
    $this->load->helper('form');
    $this->load->model('caf_model');
    //using same model to maintain caf details from agent...
  }
  
  //to enter new caf details by agent by IDEA......
  function details()
  {
    $displayform = '';
    
    $displayform .='<div id=dashboard ><span>CAF Management</span> <a href='.base_url().'/idea_home/dashboard ><img align=right src="'.base_url().'images/home.png" alt="home" /></a>
    <img align=right src="'.base_url().'images/back.png" id="back"" alt="back" ONCLICK="history.go(-1)" /></div>';
    
    $displayform .= '<br/>';
    $attr = array('id'=>'caf_review');
    $displayform .= form_open('caf_review/save',$attr);
    $displayform .= '<table>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">Retailer Name:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<input type="text" name="retailer_name" size=20 class="required" />';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">CAF Received Mode:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<input type="text" name="received_mode" size=20 class="required" />';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">Recieved Date:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<input type="text" name="date" id="date" size=18 class="required" />';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">Total Recieved CAF:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<input type="text" name="total_caf" size=20 class="required" />';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">Rejected CAF:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<input type="text" name="rejected_caf" size=20 class="required" />';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td align="right">Remarks:</td>';
    $displayform .= '<td align="left">';
    $displayform .= '<textarea cols=25 rows=4 name=remarks ></textarea>';
    $displayform .='</td>';
    $displayform .= '</tr>';
    $displayform .= '<tr>';
    $displayform .= '<td colspan=2 align=center >';
    $displayform .= form_submit('submit','Save');
    $displayform .= '&nbsp;';
    $displayform .= form_reset('reset','Reset');
    $displayform .= '</td>';
    $displayform .= '</table>';
    $displayform .= form_close();
    $data = array('formdisplay'=>$displayform);        
    $this->template->add_js('js/ui/jquery.ui.datepicker.js');
    $this->template->add_js('
        $(function() {
      $( "#date" ).datepicker(      
      {
      dateFormat: "dd/mm/yy",
      yearRange: "1900:2010",
      changeMonth: true,
      changeYear: true,
      showOn: "button",
      buttonImage: "'.base_url().'images/calendar.gif",
      buttonImageOnly: true
    
    });
    
    });

    ','embed');
    $this->template->add_js('$(document).ready(function(){
         $("#caf_review").validate();
          });
    ','embed');
    $this->template->write_view('header','header', $data, True);
    $this->template->write_view('content', 'other_general');
    $this->template->render();
  }

    function save()
    {
      
        //to save caf review information...
         $this->caf_model->caf_review_save();
         redirect("caf_review/details");
    }
    
   
}